home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / HTMLhelp.pxl < prev    next >
Text File  |  2001-03-22  |  6KB  |  215 lines

  1. {    Filename    : HTMLhelp.pxl
  2.      Purpose    : Demostrate HTMLhelp for PiXCL applications
  3.     Date        : March 2000    
  4.     Author:        S.Dibbs, VYSOR Integration Inc
  5. History:
  6.  
  7.     Version    :  1.0    RELEASE
  8.     Update    :  
  9.     Date    :  
  10.  
  11. --------------------------------------------------------------------------}
  12. Initialize: {only one instance allowed}
  13.     UseCoordinates(PIXEL)
  14.     Title$ = "PiXCL 5.0 and HTML Help systems"                                  
  15.     WinExist(Title$,Res)
  16.     If Res = 0 Then Goto One_Instance
  17.     Beep
  18.     WinSetActive(Title$,Res)
  19.     WinShow(Title$,RESTORE,Res)
  20.     End
  21. One_Instance:
  22.     UseCaption(Title$) {change the title}
  23.     WinLocate(Title$,120,200,523,624,Res)                
  24.     UseBackground(TRANSPARENT,43,189,225)     
  25.     WinShow(Title$,NOTOPMOST,Res) 
  26.     DrawBackGround
  27.  
  28.     DirGet(SourceDir$) {used later for library function calls}
  29.  
  30.     DragAcceptFile(ENABLE,AcceptFile)
  31.     AutoProgressBar(DISABLE)
  32.     SysCmdEndAt(Terminate)
  33.  
  34.     InfoMenu(REMOVE)
  35.     WaitInput(100)
  36.     SetMenu("&File",IGNORE,
  37.         "&New",CreatingFile,
  38.         "&Open",OpeningFile,
  39.         "&Save",SavingFile,
  40.         SEPARATOR,
  41.         "E&xit!",Terminate,
  42.         ENDPOPUP,
  43.         "&View",IGNORE,
  44.         "&ToolBar",ViewToolBar,
  45.         "&StatusBar",ViewStatusBar,
  46.         ENDPOPUP,
  47.         "&Information",IGNORE,
  48.         "&Concept",Concept,
  49.         "&Help",ShowAppHelp,
  50.         SEPARATOR,
  51.         "&About",About,
  52.         ENDPOPUP)
  53.  
  54.     GoSub MakeToolbar
  55.     ChangeMenuItem("&ToolBar",CHECK,TBRes)
  56.         
  57.     StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  58.     DrawStatusWinText(0,"Ready")
  59.     ChangeMenuItem("&StatusBar",CHECK,SBRes)
  60.  
  61.     UseFont("Arial",9,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  62.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  63.     SetRightMouse(cx1,cy1,cx2,cy2,RandomHelp,mx,my)
  64.  
  65.     Index = 7    
  66.  
  67.     
  68. Wait_for_Input:
  69.     WaitInput()
  70.  
  71. Terminate:
  72.     {close the help windows, if present}
  73.     WinHTMLhelp("",SIBLING,QUIT,"",0,0,0,0) 
  74.     WinHelp("PiXCL MDI Editor Help",QUIT,"")
  75.     End
  76.  
  77.  
  78. Concept:
  79.     MessageBox(OK,1,INFORMATION,
  80. "This sample shows how to access the traditional Windows HLP files, and 
  81. the new Windows 98 /  2000 HTML Help CHM files.
  82.  
  83. The client area is enabled for right mouse clicks to display a random message
  84. in an HTMLHelp popup window.",
  85.     "PiXCL and Displaying Help files",Res)
  86.  
  87.     Goto Wait_for_Input
  88.  
  89. ShowAppHelp:
  90.     WaitInput(1)
  91.     {An application Help file usually has the same name as the application.
  92.            Display both HLP and CHM for the MDI editor}
  93.  
  94.     WinHelp("..\pxl_edit.hlp",CONTENTS,"")
  95.     WinHTMLhelp("..\pxl_edit.chm",SIBLING,CONTENTS,"",0,0,0,0)
  96.  
  97.     {  {try these topics}
  98.     WinHTMLhelp("..\pxl_edit.chm",SIBLING,KEY,"MDI Editor Toolbar Buttons",0,0,0,0) 
  99.     WinHTMLhelp("..\pxl_edit.chm",SIBLING,KEY,"Building a PiXCL executable",0,0,0,0)
  100.     }
  101.  
  102.  
  103.     Goto Wait_for_Input
  104.  
  105.  
  106. RandomHelp:
  107.     WinGetLocation(Title$ ,ax1,ay1,ax2,ay2,Res)
  108.     Random(17,FontSize)  
  109.     If FontSize < 6 Then FontSize = 6
  110.     Str(FontSize,FontSize$ ) Chr(13,cr$)  Chr(34,qt$)
  111.     {charset = 0 std, 1 = alternative; 2 = graphics set }
  112.     {color = #00bbggrr  Make a random hex colour}
  113.     Random(255,Red)  Random(255,Green) Random(255,Blue)
  114.     NumToHex(Red,Red$)
  115.     NumToHex(Green,Green$)
  116.     NumToHex(Blue,Blue$)
  117.     FontColour$ = "#00"+ Red$ + Green$ + Blue$
  118.     FontString$ = "Verdana," + FontSize$ + ",," + FontColour$ + ",BOLD UNDERLINE" 
  119.     mx += ax1   my += ay1  {adjust the client coords to screen coords}
  120.  
  121.     Msg$ = "This is an HTML Help popup with a randomly sized and coloured default font. " +  
  122.         "The content of the message can be varied each time."
  123.  
  124.     WinHTMLhelp(Msg$, OWNED,POPUP,FontString$, mx,my,0,0) 
  125.     Goto Wait_for_Input
  126.  
  127. About:
  128.     AboutUser(Title$,"Two lines of text goes here e.g. Application function.",
  129.     "Four Lines of additional information goes here, perhaps contact information and Web addresses")
  130.  
  131.     Goto Wait_for_Input
  132.  
  133. ViewToolBar:
  134.     GetMenuStatus("&ToolBar",CHECKED,Res)
  135.     If Res = 0
  136.         GoSub MakeToolbar
  137.         ChangeMenuItem("&ToolBar",CHECK,Res)
  138.     Else
  139.         Toolbar()
  140.         ChangeMenuItem("&ToolBar",UNCHECK,Res)
  141.     Endif
  142.     Goto Wait_for_Input
  143.  
  144. ViewStatusBar:
  145.     GetMenuStatus("&StatusBar",CHECKED, Res)
  146.     If Res = 0
  147.         StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  148.         DrawStatusWinText(0,"Ready")
  149.         ChangeMenuItem("&StatusBar",CHECK,Res)
  150.     Else
  151.         StatusWindow(DISABLE,BOTTOM,2,200,-1,0,0)
  152.        ChangeMenuItem("&StatusBar",UNCHECK,Res)
  153.     Endif
  154.     Goto Wait_for_Input
  155.  
  156. CreatingFile:
  157.     WaitInput(1)
  158.     {TODO: add file handling here}
  159.     MessageBox(OK,1,INFORMATION,"No operations coded for this button.",
  160.                     "Creating File",Res)
  161.     Goto Wait_for_Input
  162.  
  163. OpeningFile:
  164.     WaitInput(1)
  165.     {TODO: add file handling here}
  166.     MessageBox(OK,1,INFORMATION,"No operations coded for this button.",
  167.                     "Opening File",Res)
  168.     Goto Wait_for_Input
  169.  
  170. SavingFile:
  171.     WaitInput(1)
  172.     {TODO: add file handling here}
  173.     MessageBox(OK,1,INFORMATION,"No operations coded for this button.",
  174.                     "Saving File",Res)
  175.     Goto Wait_for_Input
  176.  
  177. PrintingFile:
  178.     WaitInput(1)
  179.     {TODO: add file handling here}
  180.     MessageBox(OK,1,INFORMATION,"No operations coded for this button.",
  181.                     "Printing File",Res)
  182.     Goto Wait_for_Input
  183.  
  184.  
  185. AcceptFile:
  186.     GetDragList(FileList$)
  187.     {TODO: add file list handling here, or delete this whole label handler}
  188.     Goto Wait_for_Input
  189.     
  190. ShowCmdInfo:
  191.     DrawBackground
  192.     UseFont("Verdana",7,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  193.     PXLCMDS(FixedArgs, VariableArgs)
  194.     Str(FixedArgs,FixedArgs$)  Str(VariableArgs,VariableArgs$)
  195.     FixedArgs$ = "Number of FixedArgList commands = "+ FixedArgs$
  196.     VariableArgs$ = "Number of VariableArgList commands = "+ VariableArgs$
  197.     DrawText(15,40,FixedArgs$)
  198.     DrawText(15,70,VariableArgs$)
  199.     Goto Wait_for_Input
  200.  
  201. {--- Style Suggestion: place all subroutines at the end of the script.}
  202.  
  203. MakeToolbar: {subroutine}
  204.     Toolbar(RAISED, PXL_SMALL,
  205.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  206.         PXL_NEW, ENABLED, STD, "Create a new file", CreatingFile,
  207.         PXL_OPEN, ENABLED, STD, "Start and Check", OpeningFile,
  208.         PXL_SAVE, ENABLED, STD, "Test StrReplAll", SavingFile,
  209.         PXL_PRINT,  ENABLED, STD,"Print", PrintingFile,
  210.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  211.         IMAGEINFO,  ENABLED, STD,"PiXCL Cmd List", ShowCmdInfo,
  212.         HELPINFO, ENABLED, STD,"Show HLP and CHM Help files",ShowAppHelp)
  213.  
  214.     Return
  215.